<html>
<head><meta charset="utf-8"><title>Scalability, but at what COST? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html">Scalability, but at what COST?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224338232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224338232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224338232">(Jan 28 2021 at 15:04)</a>:</h4>
<p>Here's a fun one:</p>
<div class="codehilite"><pre><span></span><code>17:58:15|~/projects/rust-analyzer|master✓
λ t env RUN_SLOW_TESTS=1 cargo t -p rust-analyzer --release --test rust-analyzer -q

running 12 tests
............
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

real 60.08s
user 511.80s
sys  2.23s
rss  1198176k
</code></pre></div>
<div class="codehilite"><pre><span></span><code>18:01:33|~/projects/rust-analyzer|master✓
λ t env RUN_SLOW_TESTS=1 cargo t -p rust-analyzer --release --test rust-analyzer -q -- --test-threads 1

running 12 tests
............
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

real 23.55s
user 26.55s
sys  1.66s
rss  430548k
</code></pre></div>
<p>That is, running tests in multiple threads is 3x longer than using one thread in terms of wall-clock time, and wtf-times costlier in terms of CPU time</p>



<a name="224338354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224338354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224338354">(Jan 28 2021 at 15:05)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="216201">@Edwin Cheng</span> this is what I stumbled into when trying to quickly switch from progress to status</p>



<a name="224338652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224338652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224338652">(Jan 28 2021 at 15:06)</a>:</h4>
<p>Are there any ideas of what might be the issue here? These are separate tests, so there should be zero shared memory...</p>



<a name="224340049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224340049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224340049">(Jan 28 2021 at 15:16)</a>:</h4>
<p>Fascinating. It's a lot less memory too. Is it only with slow tests?</p>



<a name="224340600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224340600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224340600">(Jan 28 2021 at 15:20)</a>:</h4>
<p>My theory is our task pool is "multiplying"  the number of threads in used. Could you try to run only one test ?</p>



<a name="224340747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224340747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224340747">(Jan 28 2021 at 15:22)</a>:</h4>
<p>I mean something like: <code>env RUN_SLOW_TESTS=1 cargo t -p rust-analyzer --release --test rust-analyzer -q -- test_runnables_project  --test-threads 1</code></p>



<a name="224341341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224341341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224341341">(Jan 28 2021 at 15:25)</a>:</h4>
<p>there's no difference for a single test</p>



<a name="224342027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224342027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224342027">(Jan 28 2021 at 15:30)</a>:</h4>
<p>I can imagine cargo test have a thread pool which size of n cpu, but our task pool is also the size of n cpu. So the number of actual thread will be used is n*n. And I can imagine the context switch cost is quite large ?</p>



<a name="224342530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224342530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224342530">(Jan 28 2021 at 15:33)</a>:</h4>
<p>ok, it seems this is countme</p>



<a name="224342888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Scalability%2C%20but%20at%20what%20COST%3F/near/224342888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Scalability.2C.20but.20at.20what.20COST.3F.html#224342888">(Jan 28 2021 at 15:35)</a>:</h4>
<p>right, "enable by default" logic backfires in tests...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>